const mongoose = require('mongoose');
const { ObjectId } = mongoose.Schema;

/**
 * Export model definition object.
 */
module.exports = {
  creatorId: ObjectId,
  projectId: ObjectId,
  versionId: ObjectId,
  files: [{
    fileId: ObjectId,
    filePath: String,
    status: Number,
    functions: [{
      functionId: ObjectId,
      functionName: String,
      kind: Number,
      mangledId: String,
      language: String,
    }],
  }],
  number: Number, // 编号
  description: String,
  results: [{
    _id: ObjectId,
    number: Number,
    description: String,
    status: Number,
  }],
  status: { type: Number, default: 0 },
  analyzedResults: [String],
  type: Number,
  coverageStatistics: Boolean,
  instrumentWay: {
    type: String,
    enum: [
      'stream', // 流方式
      'bitmap', // 位图
    ],
  },
  output: {
    type: String,
    enum: [
      'console', // 控制台输出
      'file', // 文件输出
      'ethernet', // 以太网
      'port', // 串口
      'jtag', // JTAG
      'memory', // 共享内存
    ],
  },
};
